package servlet;

import component.Component;
import constant.Constant;
import dbOperation.DbSelect;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by v on 17-5-22.
 */
@WebServlet (name = "SelectServlet",value = "/SelectServlet")
public class SelectServlet extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int currentPage;

        //判断page是否合法
        try {
            currentPage=Integer.parseInt((String) req.getParameter("page"));
        }catch (Exception ex){
            currentPage=1;
        }

        String str= Component.pageBar(currentPage);


        req.setAttribute("bar",str);
        req.getRequestDispatcher("/select/select.jsp?page="+currentPage).forward(req,resp);
    }
}
